//
//  RootViewController.m
//  UI4_Delegate
//
//  Created by dllo on 15/11/11.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "RootViewController.h"
#import "RootView.h"

#warning 步骤4 - 关联协议方法(签协议)
@interface RootViewController ()<RootViewDelegate>


- (void)changeVCColor;     //  因为上面已经写了#import "RootView.h", 包含了这句,所以这句可以不写

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    RootView *rootV = [[RootView alloc] initWithFrame:CGRectMake(50, 50, 300, 500)];
//    RootView *rootV = [[RootView alloc] initWithFrame:self.view.frame];
    rootV.backgroundColor = [UIColor blueColor];
#warning 步骤5 - 设置代理人
    rootV.delegate = self;
    [self.view addSubview:rootV];
    [rootV release];
    
    
    
    
}

#warning 步骤6 - 实现协议方法(订制指定的功能)
- (void)changeVCColor
{
    self.view.backgroundColor = [UIColor blackColor];
    
    // 见名知意,写协议方法名要求的功能
//    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(200, 100, 100, 50)];
//    label.text = @"啦啦啦";
//    label.textColor = [UIColor yellowColor];
//    [self.view addSubview:label];
//    [label release];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
